package jay.home.bet.dao;

import java.util.List;
import java.util.Map;

import jay.home.bet.domain.Comp;
import jay.home.bet.domain.Event;
import jay.home.bet.domain.League;
import jay.home.bet.domain.Team;

import org.springframework.dao.DataAccessException;

public interface OddsDao
{

	Comp getComp(String id) throws DataAccessException;

	/**home,road表示球队的id, time格式为"yyyy-MM-dd HH:mm:ss"*/
	Comp getCompByDetail(String home, String road, String time)
			throws DataAccessException;

	Event getEvent(String eventid) throws DataAccessException;

	List<Event> getEvents(int page, int range) throws DataAccessException;

	/**所有未封盘的赛事, 包括正在接受投注的, 暂停的,未发布的*/
	List<Event> getAliveEvents(int page, int range) throws DataAccessException;

	/**正在接受投注的*/
	List<Event> getRunningEvents(int page, int range)
			throws DataAccessException;

	/**暂停的*/
	List<Event> getSleepingEvents(int page, int range)
			throws DataAccessException;

	/**早盘*/
	List<Event> getMorningEvents(int page, int range)
			throws DataAccessException;
	/* 尚未发布*/
	List<Event> getNoRunningEvents(int page, int range)
			throws DataAccessException;

	/**未结算的, 已经封盘*/
	List<Event> getUnsettledEvents(int page, int range)
			throws DataAccessException;

	/**根据类别获取, type的值为"单式"或"滚球"*/
	List<Event> getEventsByType(String type, int page, int range)
			throws DataAccessException;
	
	List<Event> getGunQiuEvents(int page, int range)throws DataAccessException;
	
	List<Event> getDanshiEvents(int page, int range)throws DataAccessException;

	/**通过compid获取它对应的一列比赛中的一个*/
	Event getEventByComp(String compid) throws DataAccessException;

	/**通过compid获取它对应的一列比赛*/
	List<Event> getEventsByComp(String compid, int page, int range)throws DataAccessException;
	
	List<Event> getEvents(Map map, int page, int range)throws DataAccessException;

	League getLeague(String id) throws DataAccessException;

	Team getTeam(String teamid) throws DataAccessException;

	void insertComp(Comp comp) throws DataAccessException;

	void insertEvent(Event event) throws DataAccessException;

	void insertLeague(League league) throws DataAccessException;

	void insertTeam(Team team) throws DataAccessException;

	void updateComp(Comp comp) throws DataAccessException;

	void updateEvent(Event event) throws DataAccessException;
	
	void updateEventsByComp(Event event) throws DataAccessException;

	void updateLeague(League league) throws DataAccessException;

	void updateTeam(Team team) throws DataAccessException;

	List<Team> getTeamsByLeague(String leagueid) throws DataAccessException;

	List<League> getLeagues() throws DataAccessException;

	int getByEvent(String compId) throws DataAccessException;
	
	void deleteEvent(String eventid) throws DataAccessException;
	
	List<Event> getEventsUniqueComp(int page, int range)throws DataAccessException;

	List<Comp> getSettlableComps(int page, int range)throws DataAccessException;
	
	int countEvents(Map map);

}